package com.restTemplate.config;

import com.restTemplate.entity.Info;
import com.restTemplate.entity.Person;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

/**
 * @author CKC
 * @DateTime 2021/11/22 20:14
 */
@Component
public class RestConfig {

    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

    @Bean
    public Person person(Info info){
        Person person = new Person();
        person.setName(info.getName());
        person.setAge(info.getAge());
        return person;
    }


}
